package lab02.Test30;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * Created by 李晓容 on 2017/12/31.
 */
public class Test {
    public static void main(String[] args)
    {
        double average = 0;
        double markIn;
        Scanner sc=new Scanner(System.in);
        List<Double> marks;
        marks = new ArrayList<Double>();
        do   {
            System.out.print("请输入一名学生成绩：");
            markIn=sc.nextDouble();
            marks.add(markIn);   }
        while(markIn>=0);
        int len=marks.size()-1;
        marks.remove(len);
        for(int i=0;i<len;i++){
            average+=marks.get(i)/len;   }
        System.out.print(len+"名学生成绩的平均分为："+average);
    }
}
